
books=["西游记","红楼梦","三国演义","水浒传"]
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
    browser=p.chromium.launch(headless=False)#创建页面
    page=browser.new_page()#打开页面
    page.goto("https://www.baidu.com")
    pass
    input=page.locator("#kw")#锁定搜索框位置ID
    for book in books:
        input.fill(book)#填充搜索书名
        input.press("Enter")
        for i in range(10):
            page.mouse.wheel(0,100)
            page.wait_for_timeout(500)
